home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / KSLIB11.ARJ / PK.H < prev    next >
Text File  |  1991-11-08  |  4KB  |  155 lines

  1. /* Packet driver interface classes */
  2. #define    CL_NONE                0
  3. #define    CL_ETHERNET            1
  4. #define    CL_PRONET_10        2
  5. #define    CL_IEEE8025            3
  6. #define    CL_OMNINET            4
  7. #define    CL_APPLETALK        5
  8. #define    CL_SERIAL_LINE        6
  9. #define    CL_STARLAN            7
  10. #define    CL_ARCNET            8
  11. #define    CL_AX25                9
  12. #define    CL_KISS                10
  13. #define CL_IEEE8023            11
  14. #define CL_FDDI             12
  15. #define CL_INTERNET_X25        13
  16. #define CL_LANSTAR            14
  17. #define CL_SLFP             15
  18. #define    CL_NETROM            16
  19. #define NCLASS                17
  20.  
  21. /* Packet driver interface types (not a complete list) */
  22. #define    ANYTYPE                0xffff
  23.  
  24. /* Packet driver function call numbers. From Appendix B. */
  25. #define    DRIVER_INFO            1
  26. #define    ACCESS_TYPE            2
  27. #define    RELEASE_TYPE        3
  28. #define    SEND_PKT            4
  29. #define    TERMINATE            5
  30. #define    GET_ADDRESS            6
  31. #define    RESET_INTERFACE        7
  32. #define GET_PARAMETERS        10
  33. #define AS_SEND_PKT            11
  34. #define    SET_RCV_MODE        20
  35. #define    GET_RCV_MODE        21
  36. #define    SET_MULTICAST_LIST    22
  37. #define    GET_MULTICAST_LIST    23
  38. #define    GET_STATISTICS        24
  39. #define SET_ADDRESS            25
  40.  
  41. /* Packet driver error return codes. From Appendix C. */
  42.  
  43. #define    MAXERR            16
  44.  
  45. #define    NO_ERROR        0    /* What do you think?                            */
  46. #define    BAD_HANDLE        1    /* invalid handle number                        */
  47. #define    NO_CLASS        2    /* no interfaces of specified class found        */
  48. #define    NO_TYPE            3    /* no interfaces of specified type found        */
  49. #define    NO_NUMBER        4    /* no interfaces of specified number found        */
  50. #define    BAD_TYPE        5    /* bad packet type specified                    */
  51. #define    NO_MULTICAST    6    /* this interface does not support multicast    */
  52. #define    CANT_TERMINATE    7    /* this packet driver cannot terminate            */
  53. #define    BAD_MODE        8    /* an invalid receiver mode was specified        */
  54. #define    NO_SPACE        9    /* operation failed because of insufficient space            */
  55. #define    TYPE_INUSE        10    /* the type had previously been accessed, and not released    */
  56. #define    BAD_COMMAND        11    /* the command was out of range, or not    implemented            */
  57. #define    CANT_SEND        12    /* the packet couldn't be sent (usually    hardware error)        */
  58. #define CANT_SET        13    /* hardware address couldn't be changed (> 1 handle open)    */
  59. #define BAD_ADDRESS        14    /* hardware address has bad length or format    */
  60. #define CANT_RESET        15    /* couldn't reset interface (> 1 handle open)    */
  61. #define    NO_DRIVER        16    /* There is no driver found at any interrupt    */
  62.  
  63. /*    Promiscuity mode values                */
  64.  
  65. #define    PR_NONE            1    /* Receiver off                                    */
  66. #define    PR_D            2    /* Receive direct packets only                    */
  67. #define    PR_DB            3    /* Receive direct and broadcast packets            */
  68. #define    PR_DBL            4    /* Receive direct, broadcast and lim. multicast    */
  69. #define    PR_DBM            5    /* Receive direct, broadcast and all multicast    */
  70. #define    PR_ALL            6    /* Receive all packets                            */
  71.  
  72. /*
  73. *    Weighted CPU flags values
  74. */
  75.  
  76. #define    CARRY_FLAG        0x01
  77.  
  78. /*
  79. *    Functionality return values
  80. */
  81.  
  82. #define    FN_BASIC        0x01
  83. #define    FN_EXTENDED        0x02
  84. #define    FN_HIGHPERF        0x04
  85.  
  86. /*
  87. *    Structures
  88. */
  89.  
  90. struct PKinfo {
  91.     uint    ver;
  92.     uint    class;
  93.     uint    type;
  94.     uint    number;
  95.     char    far *name;
  96.     uint    functions;
  97. };
  98.  
  99. typedef struct PKinfo PKinfo;
  100.  
  101. struct PKparam {
  102.     uint8    major_rev;
  103.     uint8    minor_rev;
  104.     uint8    length;
  105.     uint8    addr_len;
  106.     uint    mtu;
  107.     uint    multicast_aval;
  108.     uint    rcv_bufs;
  109.     uint    xmt_bufs;
  110.     uint    int_num;
  111. };
  112.  
  113. typedef struct PKparam PKparam;
  114.  
  115. struct PKstat {
  116.     ulong    packets_in;
  117.     ulong    packets_out;
  118.     ulong    bytes_in;
  119.     ulong    bytes_out;
  120.     ulong    errors_in;
  121.     ulong    errors_out;
  122.     ulong    packets_lost;
  123. };
  124.  
  125. typedef struct PKstat PKstat;
  126.  
  127. /*
  128. *    Subsidiary functions
  129. */
  130.  
  131. int        PKinit(void);
  132. int        PKcheck_int(int);
  133. void    PKerror(int);
  134. void    PKseterr(void (*)());
  135.  
  136. /*
  137. *    PC/TCP Packet Driver Specification version 1.09 functions
  138. */
  139.  
  140. PKinfo    far *PKdriver_info(int);
  141. int        PKaccess_type(int,int,int,char far *,uint,void interrupt (*)());
  142. int        PKrelease_type(int);
  143. int        PKsend_pkt(char far *,uint);
  144. int        PKterminate(int);
  145. int        PKget_address(int,char far *,int);
  146. int        PKreset_interface(int);
  147. PKparam    far *PKget_parameters(void);
  148. int        PKas_send_packet(char far *,uint,void interrupt (*)(void));
  149. int        PKset_rcv_mode(int,int);
  150. int        PKget_rcv_mode(int);
  151. int        PKset_multicast_list(char far *,int);
  152. int        PKget_multicast_list(char far *);
  153. PKstat    far *PKget_statistics(int);
  154. int        PKset_address(char far *,int);
  155.